import React, {Component} from 'react';

class SideBar extends Component {
    render() {
        return (
            <ul>
                {
                    this.props.sidebar.map(item=>{
                        const cls=this.props.currentSidebarId===item.id? " sidebar-item active":"sidebar-item"
                        return(
                            <li
                                className={cls}
                                key={item.id}
                                onClick={this.props.onItemClik.bind(this,item.id)}
                            >
                                {item.title}
                            </li>
                        )

                    })
                }
            </ul>
        );
    }
}

export default SideBar;